package info.ask4research.web.dto;

import info.ask4research.model.addons.Addon;
import info.ask4research.model.addons.MultipleChoice;
import info.ask4research.model.addons.QuestionsAndAnswers;
import info.ask4research.model.addons.TextWork;
import info.ask4research.model.addons.UploadingFiles;
import info.ask4research.model.enums.Effort;
import info.ask4research.model.enums.QuestionsDefine;


public class EditAddonDTO {

	private String title;
	private String addonInstance;
	private String id;
	
	private Integer minimum;
	private Integer maximum;
	private Integer numberOfQuestions;
	private Integer numberOfPossibleAnswers;
	private QuestionsDefine questionsDefine;
	private Effort effort;
	
	

	public EditAddonDTO(Addon addon){
		this.title = addon.getTitle();
		if (addon instanceof TextWork){
			
			this.effort = addon.getEffort();
			this.minimum = ((TextWork) addon).getMinimum();
			this.maximum = (((TextWork) addon).getMaximum());
			this.addonInstance = "TextWork";
		}else if(addon instanceof QuestionsAndAnswers){
			
			this.effort = addon.getEffort();
			this.minimum = ((QuestionsAndAnswers) addon).getMinimum();
			this.maximum = (((QuestionsAndAnswers) addon).getMaximum());
			this.questionsDefine = (((QuestionsAndAnswers) addon).getQuestionsDefine());
			this.numberOfQuestions = (((QuestionsAndAnswers) addon).getNumberOfQuestions());
			this.addonInstance = "QnA";
		}else if (addon instanceof UploadingFiles){
			
			this.effort = addon.getEffort();
			this.minimum = ((UploadingFiles) addon).getMinimum();
			this.maximum = (((UploadingFiles) addon).getMaximum());
			this.addonInstance = "UploadingFiles";
		}else if(addon instanceof MultipleChoice){
			
			this.numberOfPossibleAnswers = (((MultipleChoice) addon).getNumberOfPossibleAnswers());
			this.numberOfQuestions = (((MultipleChoice) addon).getNumberOfQuestions());
			this.questionsDefine = (((MultipleChoice) addon).getQuestionsDefine());
			this.addonInstance = "MultipleChoice";
		}
	}
	

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}


	//"cls":"folder","id":"root/learnerLeaf/cewcwefc","leaf":true,"text":"cewcwefc"
	//"text":"Controller.js","id":"src\/app\/Controller.js","leaf":true,"cls":"file"

	public Integer getMinimum() {
		return minimum;
	}

	public void setMinimum(Integer minimum) {
		this.minimum = minimum;
	}

	public Integer getMaximum() {
		return maximum;
	}

	public void setMaximum(Integer maximum) {
		this.maximum = maximum;
	}

	public Integer getNumberOfQuestions() {
		return numberOfQuestions;
	}

	public void setNumberOfQuestions(Integer numberOfQuestions) {
		this.numberOfQuestions = numberOfQuestions;
	}

	public Integer getNumberOfPossibleAnswers() {
		return numberOfPossibleAnswers;
	}

	public void setNumberOfPossibleAnswers(Integer numberOfPossibleAnswers) {
		this.numberOfPossibleAnswers = numberOfPossibleAnswers;
	}

	public QuestionsDefine getQuestionsDefine() {
		return questionsDefine;
	}

	public void setQuestionsDefine(QuestionsDefine questionsDefine) {
		this.questionsDefine = questionsDefine;
	}

	public Effort getEffort() {
		return effort;
	}

	public void setEffort(Effort effort) {
		this.effort = effort;
	}


	public String getTitle() {
		return title;
	}


	public void setTitle(String title) {
		this.title = title;
	}


	public String getAddonInstance() {
		return addonInstance;
	}


	public void setAddonInstance(String addonInstance) {
		this.addonInstance = addonInstance;
	}


}

